// 定义本地存储KEY
const KEY = 'my-token-vant-mobile'
const username = 'username'
const cityname = 'city'
const cityCode = 'citycode'

// 获取KEY
export const getToken = () => {
  return localStorage.getItem(KEY)
}
// 添加
export const setToken = (token, uname) => {
  localStorage.setItem(KEY, token)
  localStorage.setItem(username, uname)
}
// 删除
export const del = () => {
  localStorage.removeItem(KEY)
  localStorage.removeItem(username)
  localStorage.removeItem(cityname)
  localStorage.removeItem(cityCode)
}

// 添加城市名字
export const setCityname = (city) => {
  localStorage.setItem(cityname, city)
}
// 添加城市code
export const setCitycode = (code) => {
  localStorage.setItem(cityCode, code)
}
// 获取城市名字
export const getCityname = () => {
  return localStorage.getItem(cityname)
}
// 获取城市code
export const getCitycode = () => {
  return localStorage.getItem(cityCode)
}